

import 'package:flutter/material.dart';
import 'package:flutter_ideal/page/page_main.dart';

class LoginPage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return new _LoginPageState();
  }

}
class _LoginPageState extends State<LoginPage>{
  var leftRightPadding = 30.0;
  var topBottomPadding = 4.0;
  var textTips = new TextStyle(fontSize: 16.0, color: Colors.black);
  var hintTips = new TextStyle(fontSize: 15.0, color: Colors.black26);
  static const LOGO = "images/app_launcher.png";
  var _userPassController = new TextEditingController();
  var _userNameController = new TextEditingController();

  @override
  Widget build(BuildContext context) {

    return new Scaffold(appBar: new AppBar(
      title: new Text("登录",style: new TextStyle(color: Colors.white),),
    iconTheme: new IconThemeData(color: Colors.white),),
    body: new Column(
      mainAxisAlignment: MainAxisAlignment.start,
      mainAxisSize: MainAxisSize.max,
      children: <Widget>[
        new Padding(
            padding: new EdgeInsets.fromLTRB(leftRightPadding, 50, leftRightPadding, 10),
        child: Image.asset(LOGO),
        ),
        new Center(child:new Text(
            "iDeal",
          style: new TextStyle(color: Colors.black,fontSize: 18.0),

        )),
        new Padding(padding: new EdgeInsets.fromLTRB(leftRightPadding, 50, leftRightPadding, topBottomPadding),
child: new TextField(
  style: hintTips,
  controller:_userNameController ,
  decoration: new InputDecoration(hintText: "请输入用户名"),
),
        ),
        new Padding(padding: new EdgeInsets.fromLTRB(leftRightPadding, topBottomPadding, leftRightPadding , topBottomPadding),
        child: new TextField(
          style: hintTips,
          controller: _userPassController,
          decoration: new InputDecoration(hintText: "请输入登录密码"),
        ),
        ),
        new Container(
          width: 360.0,
          margin: new EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 0.0),
          padding: new EdgeInsets.fromLTRB(leftRightPadding,
              topBottomPadding, leftRightPadding, topBottomPadding),
          child: new Card(
            color: Colors.blueAccent,
            elevation: 6.0,
            child: new FlatButton(
                onPressed: () {
                  
                  Navigator.of(context).push(new MaterialPageRoute(builder: (context){

                   return new MainPage();
                  }));

                },
                child: new Padding(
                  padding: new EdgeInsets.all(10.0),
                  child: new Text(
                    '登录',
                    style:
                    new TextStyle(color: Colors.white, fontSize: 16.0),
                  ),
                )),
          ),
        )
      ],
    ),);
  }

}